fix(bitbucket): migrate off cross-workspace APIs removed by CHANGE-2770#8916
Open
KennethWKZ wants to merge 1 commit into
Open
fix(bitbucket): migrate off cross-workspace APIs removed by CHANGE-2770#8916KennethWKZ wants to merge 1 commit into
KennethWKZ wants to merge 1 commit into
Conversation
- listBitbucketWorkspaces: replace GET /user/permissions/workspaces with the supported GET /workspaces (lists the current user's workspaces). Workspace slug/name now parsed from the top level of each value instead of a nested "workspace" object.
- searchBitbucketRepos: replace cross-workspace GET /repositories?role=member with per-workspace GET /repositories/{workspace}, enumerating the user's workspaces first and aggregating up to PageSize matches.
- models: flatten GroupResponse to match the /workspaces response shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr-type/bug-fix,pr-type/feature-development, etc.Summary
What does this PR do?
Bitbucket Cloud removed its cross-workspace REST APIs as part of CHANGE-2770. The Bitbucket plugin still called these endpoints, so listing/searching remote scopes failed with HTTP 410
CHANGE-2770 - Functionality has been deprecated:(410) {"type":"error","error":{"message":"CHANGE-2770 - Functionality has been deprecated"}}
github.com/apache/incubator-devlake/plugins/bitbucket/api.listBitbucketWorkspaces
/app/plugins/bitbucket/api/remote_api.go:89
This PR migrates the plugin onto the supported workspace-scoped endpoints:
GET /user/permissions/workspaceswith the supportedGET /workspaces(lists the current user's workspaces). Workspace slug/name now parsed from the top level of each value instead of a nested"workspace"object.GET /repositories?role=memberwith per-workspaceGET /repositories/{workspace}, enumerating the user's workspaces first and aggregating up to PageSize matches.GroupResponseto match the/workspacesresponse shape.The public
remote-scopes/search-remote-scopesAPI contract is unchanged, so config-ui and Grafana need no changes.Does this close any open issues?
N/A
Screenshots
N/A, no UI changes.
Other Information
Atlassian will not ship a cross-workspace
/repositoriesreplacement, so search now issues one request per workspace and collapses pagination to the firstPageSizematches — the only path the new API surface allows.Verified:
go build ./plugins/bitbucket/...passes; manual smoke test against a Bitbucket Cloud connection (browse workspaces → repos, search remote scopes).